package org.myabstract.graph.view;

import org.eclipse.swt.graphics.Image;
import org.myabstract.graph.model.Node;

public class LabelProvider extends org.eclipse.jface.viewers.LabelProvider {

	public Image getImage(Object element) {
		if (element instanceof Node){
			return ((Node)element).getType().getImage();
		}
		return null;
	}

	public String getText(Object element) {

		if (element instanceof Node){
			return ((Node)element).getType().getLabel();
		}
		
		return element == null ? "" : element.toString();//$NON-NLS-1$
	}
}
